= form_for(@product, url: url, html: { class: 'form-horizontal' }) do |f|
  = render partial: 'shared/cpanel/error_messages', locals: { object: @product }
  .form-group
    = f.label :name, class: 'control-label col-md-2 no-padding-right'
    .col-md-8
      = f.text_field :name, class: 'form-control'
  .form-group
    = f.label :price, class: 'control-label col-md-2 no-padding-right'
    .col-md-4
      = f.number_field :price, class: 'form-control'

  .form-group
    = f.label :avatar_q_key, '照片', class: 'col-md-2 control-label no-padding-right'
    .col-md-8#upload_avatar_container
      = f.hidden_field :avatar_q_key
      = f.hidden_field :avatar_q_bucket
      = image_tag("#{@product.try(:image_url) || 'product_default.jpg' }", id: 'product_image', style: 'width: 400px; height: 400px;display: block;cursor: pointer;')

  .form-group
    = f.label :memo, class: 'control-label col-md-2 no-padding-right'
    .col-md-8
      = f.text_area :memo, rows: 8, class: 'form-control'
  .form-group
    .col-md-offset-2
      = f.submit '提交', class: 'btn btn-primary btn-outline', data: { disable_with: '请稍候...' }

:javascript
  $(function(){
    CPANEL.Products.Qiniu.init();
  });
